package com.yykj.backstage.all.controller;

import com.yykj.backstage.all.model.entity.AppSetting;
import com.yykj.backstage.all.model.entity.TouSuType;
import com.yykj.backstage.all.service.AppSettingService;
import com.yykj.common.vo.ResultVO;
import com.yykj.feign.client.backstage.dto.AppSettingDTO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/api/backstage/all/app")
@Api(tags = "App 相关设置")
@SuppressWarnings(value = "unchecked")
public class AppSettingController {

    @PostMapping("/setting/edit")
    @ApiOperation("app设置-- 添加修改")
    public ResultVO<AppSetting> editAppSetting(@RequestBody AppSetting setting){
        return ResultVO.success(appSettingService.editAppSetting(setting));
    }

    @PostMapping("/setting/view")
    @ApiOperation("app设置-- 查看")
    public ResultVO<AppSettingDTO> viewAppSetting(){
        return ResultVO.success(appSettingService.viewAppSetting());
    }

    private AppSettingService appSettingService;

    @Autowired
    public void setAppSettingService(AppSettingService appSettingService) {
        this.appSettingService = appSettingService;
    }
}
